<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Wally The Sentry Bot: Wally/Wally.ino File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wally The Sentry Bot
   &#160;<span id="projectnumber">0.2</span>
   </div>
   <div id="projectbrief">A silly Arduino project to play with sensors, Xbees and a Peggy 2.0 pegboard</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_wally_8ino.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">Wally/Wally.ino File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Wally - the sensor turret. Scans his surroundings with sensors and reports movement.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;Servo.h&gt;</code><br/>
<code>#include &lt;SoftwareSerial.h&gt;</code><br/>
<code>#include &lt;Wire.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="_wally_8h_source.html">Wally.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="i2c__peripherals_8h_source.html">i2c_peripherals.h</a>&quot;</code><br/>
<code>#include &lt;RunningMedian.h&gt;</code><br/>
</div><div class="textblock"><div class="dynheader">
Include dependency graph for Wally.ino:</div>
<div class="dyncontent">
<div class="center"><img src="_wally_8ino__incl.png" border="0" usemap="#_wally_2_wally_8ino" alt=""/></div>
<map name="_wally_2_wally_8ino" id="_wally_2_wally_8ino">
<area shape="rect" id="node9" href="_wally_8h.html" title="Wally.h" alt="" coords="348,160,415,189"/><area shape="rect" id="node11" href="i2c__peripherals_8h.html" title="i2c_peripherals.h" alt="" coords="371,83,491,112"/></map>
</div>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga9e6692d9a3b786f384e1059262aa1141"></a><!-- doxytag: member="Wally.ino::NO_PIN_STATE" ref="ga9e6692d9a3b786f384e1059262aa1141" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga9e6692d9a3b786f384e1059262aa1141">NO_PIN_STATE</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">to indicate that you don't need the pinState (save RAM/speed on PinChangeInt.h) <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga23b79226e36eb691b9d7697368baf451"></a><!-- doxytag: member="Wally.ino::NO_PIN_NUMBER" ref="ga23b79226e36eb691b9d7697368baf451" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga23b79226e36eb691b9d7697368baf451">NO_PIN_NUMBER</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">to indicate that you don't need the arduinoPin (save RAM/speed on PinChangeInt.h) <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga15f51e3ff78fd91ad93015ba59ff806b"></a><!-- doxytag: member="Wally.ino::NO_PORTC_PINCHANGES" ref="ga15f51e3ff78fd91ad93015ba59ff806b" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga15f51e3ff78fd91ad93015ba59ff806b">NO_PORTC_PINCHANGES</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">to indicate that port c will not be used for pin change interrupts (save RAM/speed on PinChangeInt.h) <br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gabaf22846f68b3e777251efeaab449d9c"></a><!-- doxytag: member="Wally.ino::xbeeSerial" ref="gabaf22846f68b3e777251efeaab449d9c" args="(xbeeRX, xbeeTX)" -->
SoftwareSerial&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gabaf22846f68b3e777251efeaab449d9c">xbeeSerial</a> (<a class="el" href="group___wally.html#ga019e754c756db6ed19d15c5c495e7896">xbeeRX</a>, <a class="el" href="group___wally.html#gae0d7ee196d1881dc17583655079ed0ee">xbeeTX</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">initialize software serial port on pins 2 and 3 for communication with XBee shield <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga4fc01d736fe50cf5b977f755b675f11d"></a><!-- doxytag: member="Wally.ino::setup" ref="ga4fc01d736fe50cf5b977f755b675f11d" args="()" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga4fc01d736fe50cf5b977f755b675f11d">setup</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The Arduino setup function. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gafe461d27b9c48d5921c00d521181f12f"></a><!-- doxytag: member="Wally.ino::loop" ref="gafe461d27b9c48d5921c00d521181f12f" args="()" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gafe461d27b9c48d5921c00d521181f12f">loop</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The Arduino main loop. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gae5ae404da647e93afb3bee73104f5a75">sensorSweep</a> (uint8_t, uint8_t, uint8_t)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform a full servo rotation sensor sweep Can perform either an initial sweep to build up template array of distances, or run a normal sweep comparing those distances to the template A movement is defined as a deviation on *both* sensors at the same angle, which typically means we ignore the wider beam and thus earlier reports of the PING))) until the Sharp IR can confirm the find.  <a href="group___wally.html#gae5ae404da647e93afb3bee73104f5a75"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga60d6df90f89c52b974d466c7176e9aca">readSensor</a> (uint8_t)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Read sensor and report back distance.  <a href="group___wally.html#ga60d6df90f89c52b974d466c7176e9aca"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gab5b4ee834b0bc248c265b98fcf28f0e0"></a><!-- doxytag: member="Wally.ino::getCamera" ref="gab5b4ee834b0bc248c265b98fcf28f0e0" args="()" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>getCamera</b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gaee21f4f992fcc2005a01c1571bfd842c">detectedSound</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if we are right now hearing anything on the sound sensor.  <a href="group___wally.html#gaee21f4f992fcc2005a01c1571bfd842c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gaf9053797c3c3d2f98e612c93db3edd79">detectedMovement</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if we are right now are seeing anything via the hall sensor.  <a href="group___wally.html#gaf9053797c3c3d2f98e612c93db3edd79"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga2fe8083d832b2df82a4dbb30a386745d"></a><!-- doxytag: member="Wally.ino::sensorTurret" ref="ga2fe8083d832b2df82a4dbb30a386745d" args="" -->
Servo&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga2fe8083d832b2df82a4dbb30a386745d">sensorTurret</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">set a variable to map the servo <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaeea7080fd7ec608976280a5db3d2f1ab"></a><!-- doxytag: member="Wally.ino::turretAngle" ref="gaeea7080fd7ec608976280a5db3d2f1ab" args="" -->
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gaeea7080fd7ec608976280a5db3d2f1ab">turretAngle</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">variable to store the servo position (0 by default) <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga852b86a2eaee9852ada7a43e61e311a2"></a><!-- doxytag: member="Wally.ino::index" ref="ga852b86a2eaee9852ada7a43e61e311a2" args="" -->
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga852b86a2eaee9852ada7a43e61e311a2">index</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">the index of the current reading <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga3d89b3b175e3facfaf9dc73a3ecf1cd3"></a><!-- doxytag: member="Wally.ino::timeDate" ref="ga3d89b3b175e3facfaf9dc73a3ecf1cd3" args="[4]" -->
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga3d89b3b175e3facfaf9dc73a3ecf1cd3">timeDate</a> [4]</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains the current time and date. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga3b22777a5996fb0c93c9597b4f36f9ff"></a><!-- doxytag: member="Wally.ino::lastMinute" ref="ga3b22777a5996fb0c93c9597b4f36f9ff" args="" -->
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga3b22777a5996fb0c93c9597b4f36f9ff">lastMinute</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">keeps track of the current minute to time XBee updates <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gace1d568317f1c4a1a8e3ba46fcca2ec1"></a><!-- doxytag: member="Wally.ino::DETECTED" ref="gace1d568317f1c4a1a8e3ba46fcca2ec1" args="" -->
boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gace1d568317f1c4a1a8e3ba46fcca2ec1">DETECTED</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">have we found someone? <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga745cffeadcb6474faf373e638af93fea"></a><!-- doxytag: member="Wally.ino::SOUND" ref="ga745cffeadcb6474faf373e638af93fea" args="" -->
boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga745cffeadcb6474faf373e638af93fea">SOUND</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">have we heard something? <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga3e033da76612d0bc5dc20d5bc6305f78"></a><!-- doxytag: member="Wally.ino::MOVEMENT" ref="ga3e033da76612d0bc5dc20d5bc6305f78" args="" -->
boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga3e033da76612d0bc5dc20d5bc6305f78">MOVEMENT</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">have we seen something <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga55a73ec5f730578c6a84a6e50c409e87"></a><!-- doxytag: member="Wally.ino::DEBUG" ref="ga55a73ec5f730578c6a84a6e50c409e87" args="" -->
const boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga55a73ec5f730578c6a84a6e50c409e87">DEBUG</a> = 1</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Increase reporting. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga0a62119651df155ee256d82601dcfeb4"></a><!-- doxytag: member="Wally.ino::interruptDisable" ref="ga0a62119651df155ee256d82601dcfeb4" args="" -->
boolean&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga0a62119651df155ee256d82601dcfeb4">interruptDisable</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">flag to disable/enable interrupts (possibly redundant with capacitors in place to prevent noise from sensors) <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga738c8636487cf9bd7f045ead07952fd3"></a><!-- doxytag: member="Wally.ino::measurePING" ref="ga738c8636487cf9bd7f045ead07952fd3" args="[servoMaxAngle]" -->
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#ga738c8636487cf9bd7f045ead07952fd3">measurePING</a> [<a class="el" href="group___wally.html#ga5693c3de30d9155d123f797cb6799ecb">servoMaxAngle</a>]</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Array for PING))) measurements. We only measure in 1 degree steps. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gad7efe61a5c34484d807ea7365ce27b3e"></a><!-- doxytag: member="Wally.ino::measureIR" ref="gad7efe61a5c34484d807ea7365ce27b3e" args="[servoMaxAngle]" -->
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___wally.html#gad7efe61a5c34484d807ea7365ce27b3e">measureIR</a> [<a class="el" href="group___wally.html#ga5693c3de30d9155d123f797cb6799ecb">servoMaxAngle</a>]</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Array for IR measurements. We only measure in 1 degree steps. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Wally - the sensor turret. Scans his surroundings with sensors and reports movement. </p>
<p>Wally - the sensor turret. Scans his surroundings with sensors and reports movement. PINs in use: A0 : IR sensor (in)<br/>
 A1 : line scanner sensor (in)<br/>
 A4 : I2C communication<br/>
 A5 : I2C communication<br/>
 <br/>
 2 : RX pin for XBee shield<br/>
 3 : TX pin for Xbee shield<br/>
 4 : sound impact sensor 5 : movement sensor (XXXX WHITE?) 7 : PING))) ultrasound sensor (in)<br/>
 4 : sound sensor (in)<br/>
 9 : servo control (out)<br/>
 10 : line scanner clock signal 11 : line scanner sync signal 13 : Laser (high to switch on) </p>
</div></div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_wally_8ino.html">Wally.ino</a>      </li>

    <li class="footer">Generated on Thu May 24 2012 00:05:01 for Wally The Sentry Bot by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
